package com.dearbinge.web.user.controller;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.dearbinge.data.redis.service.RedisService;



@Controller
@ImportResource({ "classpath:applicationContext.xml", "dubbo-services.xml" })
@EnableAutoConfiguration
public class UserController extends WebMvcConfigurerAdapter {

	@Autowired
	private RedisService  redisService;


	@ResponseBody
	@RequestMapping(value = "/set", method = RequestMethod.GET)
	public void set(@RequestParam(name = "key") String key, @RequestParam(name = "value") String value) {
		System.out.println("dsddddddddddddddddd");
//		Result result = new Result();
//		try {
//			String set1 = redisService.set(key, value);
//			boolean exists = redisService.exists(key);
////			long hlen = redisService.hlen("luohuiMap");
//			System.out.println("append==="+set1+"exists=="+exists);
//			return result.ok().setData(exists);
//		} catch (Exception ex) {
//			ex.printStackTrace();
//			result.fail().setMsg("添加记录,如果记录已存在将覆盖原有的value异常");
//		}
//		return result.ok();
	}


}
